<?php
/**************************************/
// World of Warcraft Armory SDK       //
// Userbars module                    //
// Licence: GNU GPLv3                 //
// Author: Giacomo 'elegos' Furlan    //
// File: templates/simpleTemplate.php //
/**************************************/

	// include the wowasdk framework
	require_once("wowasdk/wowasdk.include.php");
	
	// main function: this is required for the system, don't change the variables as input.
	function template($name, $region, $realm) {
		// let's load the player's wowasdk class.
		$data = new wowasdk_character($region,$realm,$name);
		
		// here are some variables I extract from wowasdk for the contents.
		// see the wowasdk documentation to find a list of functions.
		$level = $data->getLevel();
		$genderID = $data->getGenderId();
		$name = $data->getName();
		$class = $data->getClass();
		$raceID = $data->getGenderId();
		$factionID = $data->getFactionId();
		$guild = $data->getGuildName();

		// these files are located in templates/(template name)/
		$faction_img = "faction_".$factionID.".gif";
		// the background is a gif image, so your extension will be .gif (see README file).
		// it is advised to use PNG images because of possible palette errors.
		$background = "bg_".$factionID.".gif";
		
		// All the instructions are passed via arrays.
		
		// image template
		// faction image
		$faction_image = array(
			"source" => $faction_img, // name of the file (see $faction_img)

			"x" => 1, // X coordinate (top left)
			"y" => 1, // Y coordinate (top left)

			"width" => 59, // width of the image (in pixels)
			"height" => 17, // height of the image (in pixels)
			
			"opacity" => 100 // opacity of the image (in % 0-100)
		);
		
		// text template
		// single line name - class - level text
		$string = array(
			"content" => $name." ".$class." lvl ".$level." - ".$guild, // Just write what you want.
			
			"font" => "MORPHEUS.TTF", // Font to use. It's a template resource located in its folder.
			"size" => 11, // Size of the font (in pixels). Just like in Word :P
			
			"red" => 0, // Red component of the text color.
			"green" => 0, // Green component of the text color.
			"blue" => 0, // Blue component of the text color.
			
			"x" => 59, // X coordinate of the text (top left)
			"y" => 14, // Y coordinate of the text (top left)
		);
		
		// The function template will return an array.
		// It's divided into images and textes.
		// Images will be processed first, textes in a second moment.
		// If you invert the positions, textes will be under the images.
		return array(
			// Required variable: you must start from a background image.
			// This will determine the MIME type of the image.
			"background" => $background,
			"images" => array(
				// here go all the image arrays previously made.
				$faction_image,
			),
			"textes" => array(
				// here go all the text arrays previously made.
				$string,
			),
		);
	}
?>